import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProcessInfoVO, ProcessInfoForm, ProcessInfoQuery } from '@/api/farm/common/processInfo/types';

/**
 * 查询加工详情列表
 * @param query
 * @returns {*}
 */

export const listProcessInfo = (query?: ProcessInfoQuery): AxiosPromise<ProcessInfoVO[]> => {
  return request({
    url: '/farm/processInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询加工详情详细
 * @param id
 */
export const getProcessInfo = (id: string | number): AxiosPromise<ProcessInfoVO> => {
  return request({
    url: '/farm/processInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增加工详情
 * @param data
 */
export const addProcessInfo = (data: ProcessInfoForm) => {
  return request({
    url: '/farm/processInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改加工详情
 * @param data
 */
export const updateProcessInfo = (data: ProcessInfoForm) => {
  return request({
    url: '/farm/processInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除加工详情
 * @param id
 */
export const delProcessInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/farm/processInfo/' + id,
    method: 'delete'
  });
};
